package cn.juque.redoctopus.disruptor.event;

import cn.juque.common.base.DisruptorBody;
import cn.juque.common.disruptor.IBusinessEventService;
import cn.juque.redoctopus.bo.disruptor.TestBO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @author nuoka
 * @version 1.0.0
 * <li>IntelliJ IDEA</li>
 * <li></li>
 * @date 2021/8/24 23:35
 **/
@Slf4j
@Service("testEventService")
public class TestEventServiceImpl implements IBusinessEventService {

    /**
     * 具体消费者的实现
     *
     * @param disruptorBodyBO 消息体
     */
    @Override
    public void invoke(DisruptorBody disruptorBodyBO) {
        TestBO testBO;
        if(disruptorBodyBO instanceof TestBO) {
            testBO = (TestBO) disruptorBodyBO;
            log.info("consumer a test message:{}", testBO.getMsg());
        }
    }
}
